<?php
	if(isset($_GET['keyword']))
	{
		echo 'You are looking for : <span style="color:red;">'.$_GET['keyword'].'</span>';
	}
?>
<div id="search">
    <center>
 	   <input type="text" name="keyword" id="searchBox" onchange="searching();" value="Search Here... and press Enter" onclick="this.value=''" size="60px"/>
        <img src="site/images/search.png" id="search" />
   </center>
   <div id="suggestions"></div>
    <center>
        <input type="checkbox" id="ann" onclick="a = check_type(this,1);" name="search_type[]" value="announcement" />&nbsp;&nbsp;Announcement &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
        <input type="checkbox" id="biz" name="search_type[]" onclick="a = check_type(this,2);" value="business" />&nbsp;&nbsp;Business<br />
    </center>
</div>
<script>
	var a = 0;
	if(document.getElementById("ann").checked == true)
		a += 1;
	if(document.getElementById("biz").checked == true)
		a += 2;
	function check_type(ch,n)
	{
		if(ch.checked == true)
			n = a + n;
		else
			n = a - n;
		return n;
	}
	//for auto suggesting
	$("input#searchBox").keypress(function(e){
		if(e.keyCode == 13) 
		{
			var keyword = document.getElementById("searchBox").value;
			var url = 'search-'+a+'-'+keyword+'.php';
			window.location = url;
    	}
		/*else
		{
			//var keyword = $("input#searchBox").val();
			var keyword = document.getElementById("searchBox").value;
			var url = 'site/class/controller.php?type=content&method=getSuggestions&content_type=search&keyword='+keyword;
			$("div#suggestions").load(url);
		}*/
	});
	$("input#searchBox").blur(function(){
		$("div#suggestions").html("");
	});
</script>